Skip to content

feat(CI): extract JSON from CLI output for downstream usage#21

Closed
Cristian-Vogel wants to merge 1 commit intocrabnebula-dev:mainfrom
Cristian-Vogel:extract_JSON_to_GITHUB_OUTPUT
Closed

feat(CI): extract JSON from CLI output for downstream usage#21
Cristian-Vogel wants to merge 1 commit intocrabnebula-dev:mainfrom
Cristian-Vogel:extract_JSON_to_GITHUB_OUTPUT

Conversation

@Cristian-Vogel
Copy link
Copy Markdown
Collaborator

@Cristian-Vogel Cristian-Vogel commented Mar 6, 2026

Exposes
* release: The full JSON object of the release.
* release-id: The unique identifier of the created release.
* release-version: The version string of the release.

Added a TL;DR to help understand the how and why of this wrapper.

Bumped semver, no breaking changes.

…HUB_OUTPUT.

Added a TL;DR to help understand the how and why of this wrapper.

Bumped semver, no breaking changes.
@Cristian-Vogel Cristian-Vogel requested a review from a team as a code owner March 6, 2026 14:05
@Cristian-Vogel Cristian-Vogel changed the title v0.2.7: extract JSON from CLI output and store release details in GIT… v0.2.7: extract JSON from CLI output for downstream usage Mar 6, 2026
@Cristian-Vogel Cristian-Vogel changed the title v0.2.7: extract JSON from CLI output for downstream usage feat(CI): extract JSON from CLI output for downstream usage Mar 6, 2026
@denjell-crabnebula
Copy link
Copy Markdown

Please review this file for insight into how to properly manage changes:
https://github.com/crabnebula-dev/cloud-release/tree/main/.changes

Comment thread action.yml
Comment on lines +110 to +127
# Try to extract JSON from the output
if JSON=$(echo "$OUTPUT" | sed -n '/^{/,/}/p' | jq -c '.' 2>/dev/null); then
if [ -n "$JSON" ]; then
echo "release<<nEOFn" >> $GITHUB_OUTPUT
echo "$JSON" >> $GITHUB_OUTPUT
echo "nEOFn" >> $GITHUB_OUTPUT

ID=$(echo "$JSON" | jq -r '.id // empty')
if [ -n "$ID" ]; then
echo "release-id=$ID" >> $GITHUB_OUTPUT
fi

VERSION=$(echo "$JSON" | jq -r '.version // empty')
if [ -n "$VERSION" ]; then
echo "release-version=$VERSION" >> $GITHUB_OUTPUT
fi
fi
fi
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assumes the stdout will contain valid JSON. And the only type ever returned is a release object.

That's very limiting in terms of features the CLI could implement. So supporting output variables should be done by the CLI, which is aware of what outputs are supposed to be generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants